<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	
		<style type="text/css">
			body{
				padding-top: 50px;
			}
		</style>
	</head>
	<script>
		onload = function(){
			var divs = document.getElementsByTagName("div");
			
			for(var i=0; i<divs.length; i++){
				divs[i].onclick = function(){
					alert(this.getAttribute("txt"));
				}
			}
			document.body.onclick = function(){
				alert("BODY!!!!");
			}
			document.onclick = function(){
				alert("DOCUMENT!!!!");
			}
		}
	</script>
	<body>
		<div txt="BIG" style="margin:auto;width:500px; height:500px; background:#aaa333; position:relative">
			<div txt="SMALL" style="position:absolute; left: -300px; top: 50px;width:200px; height:200px; background:#f40">
				
			</div>
		</div>
	</body>
</html>
